/*
 *  Copyright 2015-2016, RenGu Technology (BeiJing) Co., Ltd.
 *  All right reserved.
 *
 *  THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF RENGU TECHNOLOGY (BeiJing) CO., LTD.
 *
 *  THE CONTENTS OF THIS FILE MAY NOT BE DISCLOSED TO THIR PARTIES,
 *  COPIED OR DUPLICATED IN ANY FORM, IN WHOLE OR IN PART,
 *  WITHOUT THE PRIOR WRITTEN PERMISSION OF RENGU TECHNOLOGY (BeiJing) CO., LTD.
 *
 *  AcctTxnNumEnum
 *
 *  Edit History:
 *      lizhangtao Created on 2020年05月15日
 *
 */
package cc.rengu.igas.route.common.enums;

/**
 * 智能路由模块自身无交易码，
 * 复用智能路由业务在能力开放的标准的交易
 *
 * @author lizhangtao
 * @version 1.0
 * @date 2020/5/15
 */
public enum RouteTxnNumEnum {
    /**
     * 路由查询
     */
    ROUTER_QUERY("T00CP001", "0000", "IntelligenceRouterQueryService", "路由查询"),
    /**
     * 对外付款
     */
    CREDIT("P01CP001", "2300", "IntelligenceCreditService", "对外付款"),
    /**
     * 对外收款签约
     */
    PAYMENT_SIGN("T00CP002", "2400", "IntelligencePaymentSignService", "对外收款签约"),
    /**
     * 对外收款签约确认
     */
    PAYMENT_SIGN_VERIFY("T05CP002", "2400", "IntelligencePaymentSignVerifyService", "对外收款签约确认"),
    /**
     * 对外收款
     */
    PAYMENT("P01CP002", "2200", "IntelligencePaymentService", "对外收款"),
    /**
     * 对外收款确认
     */
    PAYMENT_VERIFY("P05CP002", "2200", "IntelligencePaymentVerifyService", "对外收款确认"),
    /**
     * 交易结果查询
     */
    RESULT_QUERY("T00CP003", "0000", "IntelligenceResultQueryService", "交易结果查询"),
    ;
    private String txnNum;
    private String txnGroup;
    private String service;
    private String desc;

    RouteTxnNumEnum(String txnNum, String txnGroup, String service, String desc) {
        this.txnNum = txnNum;
        this.txnGroup = txnGroup;
        this.service = service;
        this.desc = desc;
    }

    public String getTxnNum() {
        return txnNum;
    }

    public String getTxnGroup() {
        return txnGroup;
    }

    public String getService() {
        return service;
    }

    public String getDesc() {
        return desc;
    }

    public static RouteTxnNumEnum getInstance(String txnNum) {
        switch (txnNum) {
            case "T00CP001":
                return ROUTER_QUERY;
            case "P01CP001":
                return CREDIT;
            case "T00CP002":
                return PAYMENT_SIGN;
            case "T05CP002":
                return PAYMENT_SIGN_VERIFY;
            case "P01CP002":
                return PAYMENT;
            case "P05CP002":
                return PAYMENT_VERIFY;
            case "T00CP003":
                return RESULT_QUERY;
            default:
                return null;
        }
    }

    public static RouteTxnNumEnum getInstanceFromTxnGroup(String txnGroup) {
        switch (txnGroup) {
            case "2200":
                return PAYMENT;
            case "2300":
                return CREDIT;
            case "2400":
                return PAYMENT_SIGN;
            default:
                return null;
        }
    }
}
